package com.example.demo.utils.webSocketUtils

import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.ConcurrentMap

object WebSocketMapUtil {
    var webSocketMap: ConcurrentMap<String, WebSocketServer> = ConcurrentHashMap()
    fun put(key: String, webSocketServer: WebSocketServer) {
        webSocketMap[key] = webSocketServer
    }

    operator fun get(key: String): WebSocketServer? {
        return webSocketMap[key]
    }

    fun remove(key: String) {
        webSocketMap.remove(key)
    }

    val values: Collection<WebSocketServer>
        get() = webSocketMap.values
}